<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="X-UA-Compatible" content="chrome=1;IE=edge">
    <meta name="viewport" content="user-scalable=no">
    <!-- vue2 -->
    <script src="/examples/js/vue.min.js"></script>
    <!-- 示例演示-公共样式 -->
    <link rel="stylesheet" href="/examples/css/railView.css" type="text/css" />
    <!-- 引入样式 -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <!-- 引入组件库 -->
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
    <!-- RailUnit 样式 -->
    <link rel="stylesheet" href="/RailUnit/RailUnit.umd.css" type="text/css">
    <!-- RailUnit 插件 -->
    <script type="text/javascript" src="/RailUnit/RailUnit.umd.js" charset="utf-8"></script>
</head>
<body>
    <div id="app">
        <div id="buttom-container">
            <el-button type="info" @click="handleSpin">旋转</el-button>
            <el-button type="info" @click="handleDISTPan">目标距离平移</el-button>
            <el-button type="info" @click="handleDotPan">目标点平移</el-button>
            <el-button type="info" @click="handleZoom">缩放</el-button>
            <el-button type="info" @click="handleReset">恢复构件状态</el-button>
            <el-button type="info" @click="handleGetSate">获取构件状态</el-button>
        </div>
        <div id="viewer" style="width:100%;height:100%;position:relative;float:left"></div>
    </div>
    <script id="viewerStartup" type="module">
         const vm = new Vue({
            el: '#app',
            data: {
                bimViewer: null,
            },
            mounted () {
                this.bimViewerFn()
            },
            methods: {
                // 初始化模型
                bimViewerFn() {
                    this.bimViewer = new MyViewer({
                        serverUrl: '/RailUnit/',
                        containerElement: document.getElementById('viewer'),
                        nodeVisible: false
                    })
                    this.bimViewer.loadModel2('jianzhu')
                },
                // 旋转
                handleSpin() {
                    const res = this.bimViewer.setSolidTranslate('2cgXCjpDT0ZxBvxMSr3pfm',[1,2,3])
                    console.log(res, '旋转');
                },
                // 目标距离平移
                handleDISTPan() {
                    // this.bimViewer.setSolidTranslationWithDistance(...ids, { x: 10000, y: 0, z: 0 });
                    this.bimViewer.setSolidTranslate('2cgXCjpDT0ZxBvxMSr3pfm',[1,2,3])
                },
                // 目标点平移
                handleDotPan() {
                    // this.bimViewer.setSolidTranslationWithPoint3(...ids, { x: 0, y: 10000, z: 0 });
                    this.bimViewer.setSolidTranslationWithPoint3('2cgXCjpDT0ZxBvxMSr3pfm',[1,2,3])
                },
                // 缩放
                handleZoom() {
                    // this.bimViewer.setSolidScale(...ids, 0.5);
                    this.bimViewer.setSolidScale('2cgXCjpDT0ZxBvxMSr3pfm',[1,2,3])
                },
                // 恢复构件状态
                handleReset() {
                    this.bimViewer.unsetSolidStatus('2cgXCjpDT0ZxBvxMSr3pfm');
                },
                // 获取构件状态
                handleGetSate() {
                    let solidStatus = this.bimViewer.getSolidStatus('2cgXCjpDT0ZxBvxMSr3pfm');
                    console.log(solidStatus, '获取构件状态');
                    // alert(solidStatus.m);
                }
            }
        })
        
    </script>
</body>
</html>
